package stool.flyweight;

import java.util.Hashtable;

/**
 * @Author Felix YF Dong
 * @Date 2021/5/16
 */
public class WebSiteFactory {

    private Hashtable<Object, Object> flyweights = new Hashtable<>();

    public WebSite findWebSiteCategory(String key) {

        if (!flyweights.containsKey(key)) {
            flyweights.put(key, new ConcreteWebSite(key));
        }

        return (WebSite) flyweights.get(key);
    }

    public int findWebSiteCount() {
        return flyweights.size();
    }
}
